package 适配器模式;

/**
 * 适配器模式
 *  应用场景:
 *      第一版的系统中一个接口，需要在新版的系统中兼容使用
 *
 */
public class WithoutAdapterPattern {

    public static void main(String[] args) {
        OldInterfaceImpl oldInterface = new OldInterfaceImpl();
        oldInterface.oldExecute();
        NewInterfaceImpl newInterface = new NewInterfaceImpl();
        newInterface.oldExecute();
    }

    public static interface OldInterface {
        void oldExecute();
    }


    public static class OldInterfaceImpl implements  OldInterface {

        @Override
        public void oldExecute() {
            System.out.println("老版本接口实现的功能逻辑");
        }
    }


    public static interface NewInterface {
        void oldExecute();
    }


    public static class NewInterfaceImpl implements  NewInterface {

        @Override
        public void oldExecute() {
            System.out.println("新版本接口实现的功能逻辑");
        }
    }
}
